package com.buptlogistics.creditinvestigation.activity;

import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.widget.ListView;

import com.buptlogistics.creditinvestigation.R;
import com.buptlogistics.creditinvestigation.app.AppData;
import com.buptlogistics.creditinvestigation.app.BaseActivity;


/**
 * <p>
 * Title: WelcomeActivity
 * </p>
 * <p>
 * Description:
 * </p>
 *
 * @author fuxuemingzhu
 * @email fuxuemingzhu@163.com
 */
public class WelcomeActivity extends BaseActivity {

    private ListView listView;
    boolean isLogin;

    private String chance;
    private String company_code;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        AppData.getInstance(this);
        isLogin = AppData.getInstance(this).getIsLogin();
        company_code = AppData.getInstance(this).getCompanyCode();

        // // LeanCLoud
        // AVOSCloud.initialize(this, Constants.getLeanAppId(),
        // Constants.getLeanAppKey());
        // // 设置默认打开的 Activity
        // PushService.setDefaultPushCallback(this, PushMessage.class);
        // //////////////////////////////////////////
        //if (!isLogin) {
        //    // 没有登录
        //    AppData.getInstance(this).setLogin(false);
        //
        //    // TODO
        //    initEvents();
        //    // 创建Bundle对象
        //    // 创建一个Intent
        //    // 启动intent对应的Activity
        //    Intent intent = new Intent(WelcomeActivity.this, LoginRegistActivity.class);
        //    // 启动intent对应的Activity
        //    startActivity(intent);
        //    WelcomeActivity.this.finish();
        //
        //} else {
        //    /**
        //     *获取当前公司评分
        //     */
        //    //chance = IcyBeeUtil.getStockResult(company_code, this);
        //    chance = "" + 83;
        //}
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent = new Intent(WelcomeActivity.this,
                        MainActivity.class);
                // 启动intent对应的Activity
                startActivity(intent);
                WelcomeActivity.this.finish();
            }
        }, 1000);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        // getMenuInflater().inflate(R.menu.splash, menu);
        return true;
    }

    /*
     * (non-Javadoc)
     *
     * @see
     * android.app.Activity#onConfigurationChanged(android.content.res.Configuration
     * )
     */
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        // TODO Auto-generated method stub
        super.onConfigurationChanged(newConfig);
    }

    /*
     * (non-Javadoc)
     *
     * @see com.hmammon.campuscalendar.app.BaseActivity#initViews()
     */
    @Override
    protected void initViews() {
        // TODO Auto-generated method stub

    }

    /**
     * （非 Javadoc）
     * <p>
     * Title: initEvents
     * </p>
     * <p>
     * </p>
     */
    @Override
    protected void initEvents() {
    }

    /**
     * （非 Javadoc）
     * <p>
     * Title: onResume
     * </p>
     * <p>
     * Description:
     * </p>
     *
     * @see android.app.Activity#onResume()
     */
    @Override
    protected void onResume() {
        super.onResume();
    }

    /**
     * （非 Javadoc）
     * <p>
     * Title: onPause
     * </p>
     * <p>
     * Description:
     * </p>
     *
     * @see android.app.Activity#onPause()
     */
    @Override
    protected void onPause() {
        super.onPause();
    }

}
